home *** CD-ROM | disk | FTP | other *** search
- Path: news.goodnet.com!goodguy!geoff
- From: geoff@goodguy (GEOFF CADIEN)
- Newsgroups: comp.lang.c++
- Subject: overloading []
- Date: 16 Jan 1996 16:22:13 GMT
- Organization: GoodNet
- Message-ID: <4dgjbl$6i3@news1.goodnet.com>
- NNTP-Posting-Host: goodnet.com
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- Here is my question. I have a class foo in which I have overloaded the
- array subscript operator. I have no problem doing something like this:
-
- foo f;
-
- f[1] = 10;
-
- my problem is this. Given,
-
- foo *f;
-
- f = new foo;
-
- Now the only way I can use the subscript operator is to call it like this
-
- f->operator[](1) = 10;
-
- Is this the only way?
-
- Geoff Cadien
- geoff@goodnet.com
-